<{include file="../modules/_manager/header.html" title='在庫管理'}>
<script src="<{$ROOTPATH}>/_manager/scripts/vars/sto.js.php"></script>
<script> jQuery(function($){page.init();}); </script>
<div class="block">
	<h1>ストック >> 在庫管理(<{*$len*}>件)</h1>
	<h2><a class="typeLink" onclick="page.todo(-1,2)">在庫を新規作成する</a></h2>
<{$sumall = 0}>
<{$sumcntall = 0}>
<{$sumcntout = 0}>
<table class="table_list">
	<thead>
		<tr class="header">
			<td>商品名</td>
			<td>型番</td>
			<td>入荷</td>
			<td>出荷</td>
			<td>在庫</td>
			<td>単価</td>
			<td>小計</td>
			<td>出荷する</td>
			<td>仕入れ履歴</td>
			<{if $login_levelno  gt 85}>
			<td>編集</td>
			<{/if}>
			<td>削除</td>
		</tr>
	</thead>
	<tbody>
		<{foreach $listview as $entry}>
			<{if $entry@iteration is even by 1}>
				<tr class="iteration">
			<{else}>
				<tr>
			<{/if}>
				<{$sumcntall=$sumcntall+$entry.numbers}>
				<{$sumcntout=$sumcntout+$entry.slistcnt}>
				<{$sumall=$sumall+$entry.sumprice}>
				<td class="nline"><{$entry.name}></td>
				<td class="nline"><{$entry.model}></td>
				<td class="typeNumber nline"><{$entry.numbers}></td>
				<td class="typeNumber nline"><{$entry.slistcnt}></td>
				<td class="typeNumber nline">
				<strong>
				<{if $entry.numbers-$entry.slistcnt lt 5}>
					<font color="red"><{$entry.numbers-$entry.slistcnt}></font>
				<{else}>
					<{$entry.numbers-$entry.slistcnt}>
				<{/if}>
				</strong>
				</td>
				<td class="typeMoney nline"><{$entry.price}></td>
				<td class="typeMoney nline"><{$entry.sumprice}></td>
				<td class="nline">
					<a class="typeLink" onclick="page.todo(<{$entry.prodId}>,6)">出荷する</a>
					<input type="hidden" value="<{$entry.name}>" id="sto_name_hidden_<{$entry.stoId}>">
					<input type="hidden" value="<{$entry.model}>" id="sto_model_hidden_<{$entry.stoId}>">
					<input type="hidden" value="<{$entry.numbers}>" id="sto_numbers_hidden_<{$entry.stoId}>">
					<input type="hidden" value="<{$entry.price}>" id="sto_price_hidden_<{$entry.stoId}>">
					<input type="hidden" value="<{$entry.sumprice}>" id="sto_sumprice_hidden_<{$entry.stoId}>">
				<td class="nline">
					<a class="typeLink" onclick="page.todo(<{$entry.stoId}>,7)">仕入れ履歴</a>
				</td>
				<{if $login_levelno gt 85}>
				<td class="nline">
					<a class="typeLink" onclick="page.todo(<{$entry.stoId}>,0)">編集</a>
				</td>
				<{/if}>
				<{if $login_adminId == 1 or $login_adminId == 3}>
				<td>
					<a class="typeLink" onclick="blockDesign.message( $(page.delsto_form._name),'382px');
						$('#delete_prod_id').val('<{$entry.prodId}>');">削除</a>
				</td>
				<{/if}>
			</tr>
		<{/foreach}>
		</tbody>
		<tfoot class="header">
			<tr>
				<td></td><td>合計：</td>
				<td><{$sumcntall}></td><td><{$sumcntout}></td>
				<td><{$sumcntall-$sumcntout}></td><td></td>
				<td class="typeMoney"><{$sumall}></td>
				<td></td><td></td>
				<{if $login_levelno gt 85}>
					<td></td>
				<{/if}>
				<{if $login_adminId == 1 or $login_adminId == 3}>
					<td></td>
				<{/if}>
			</tr>
		</tfoot>
	</tbody>
</table>
</div>
<div id="newsto_form" class="new_form" style="display:none;">
	<div id="newsto_form_title"></div>
	<div>
		<table>
			<tr>
				<td style="width:150px;">日付:</td>
				<td>
					<input type="text" readonly="readonly" size="10"  id="new_form_dates" class="date" value="<{$DATENOW}>">
				</td>
			</tr>
			<tr>
				<td>所属批次:</td>
				<td>
					<select id="new_form_shipId">
						<option value="-1">選択してください。</option>
						<{foreach $ship_listview as $entry}>
							<option value="<{$entry.shipId}>"><{$entry.dates}>(<{$entry.priceJp}>円)</option>
						<{/foreach}>
					</select>
				</td>
			</tr>
			<tr>
				<td>商品選択:</td>
				<td>
					<select id="new_form_prodId">
						<option value="-1">選択してください。</option>
						<{foreach $prod_listview as $entry}>
							<option value="<{$entry.prodId}>"><{$entry.model}>(<{$entry.name}>)</option>
						<{/foreach}>
					</select>
				</td>
			</tr>
			<tr>
				<td>仕入れ単価（円）:</td>
				<td>
					<input type="text" value="" id="new_form_unitprice" onChange="utilityHandle.toHankaku(this)" />
				</td>
			</tr>
			<tr>
				<td>個数:</td>
				<td>
					<input type="text" value="" id="new_form_number" style="width: 40px;" onChange="utilityHandle.toHankaku(this)" />
				</td>
			</tr>
		</table>
		<input type="hidden" value="0" id="sto_id_hidden">
	 	<a class="typeLink" id="new_form_ok" onclick="if($('#sto_id_hidden').val()==0)page.add(); else  page.update();">新規作成</a>
		<a class="typeLink" onclick="$.unblockUI();">Close</a>
	</div>
</div>


<div id="sell_form" class="new_form" style="display:none;">
	<div id="sell_form_title"></div>
	<div>
		<table>
			<tr>
				<td style="width:120px;">出荷日:</td>
				<td>
					<input type="text" readonly="readonly" size="10"  id="sell_form_dates" class="date" value="<{$DATENOW}>">
				</td>
			</tr>
			<tr>
				<td>落札者ID:</td>
				<td>
					<input type="text" value="" id="sell_form_userSn" />
				</td>
			</tr>
			<tr>
				<td colspan="2">発送先</td>
			</tr>
			<tr>
				<td colspan="2">
					〒<input type="text" value="" id="sell_form_post" size="7" />
					住所：<input type="text" value="" id="sell_form_address" size="50"  />
					お名前：<input type="text" value="" id="sell_form_name" size="10"  />TEL:<input type="text" value="" id="sell_form_tel" size="18" />
				</td>
			</tr>
			<tr>
				<td>商品:</td>
				<td><a class="typeLink" onclick="page.add_sell_prod(0)">商品追加</a></td>
			</tr>
			<tr>
				<td id="sell_form_prods" colspan="2">
					
				</td>
			</tr>
			<tr>
				<td>送料:</td>
				<td>
					<input type="text" value="" id="sell_form_fee" onChange="utilityHandle.toHankaku(this)" />
					<input type="checkbox" id="sell_form_tofee" value="1" onclick="$('#sell_form_fee').val(0)" /><label for="sell_form_tofee">送料着払</label>
					<br/>出品時に掲載した送料、送料着払の場合は送料着払を選択してください。
				</td>
			</tr>
		</table>
		<input type="hidden" value="0" id="sell_id_hidden">
	 	<a class="typeLink" id="sell_form_ok" onclick="page.output()"></a>
		<a class="typeLink" onclick="$.unblockUI();">Close</a>
	</div>
</div>

<div id="delsto_form" class="new_form" style="display:none;">
	<div>
		商品の仕入れを削除されます。<br/>削除しますか？
	</div>
	<div>
		<a class="typeLink" onclick="page.todo(-1,1)">削除する</a> <a class="typeLink" onclick="$.unblockUI();">キャンセル</a>
	</div>
	<input type="hidden" id="delete_prod_id" value="" />
</div>
<select class="sel_product_list" id="sel_product_list" style="display:none;">
	<option value="-1">選択してください。</option>
	<{foreach $prod_listview as $entry}>
		<option value="<{$entry.prodId}>"><{$entry.model}>(<{$entry.name}>)</option>
	<{/foreach}>
</select>


<{include file="../modules/_manager/footer.html"}>